//
//  YUserInfo.m
//  MUBATE
//
//  Created by sunbin on 2017/2/15.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "YUserInfo.h"
@interface YUserInfo()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end

@implementation YUserInfo

+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
        self.store_name               = [self objectOrNilForKey:@"store_name" fromDictionary:dict];
        self.company_name             = [self objectOrNilForKey:@"company_name" fromDictionary:dict];
        self.province                 = [self objectOrNilForKey:@"province" fromDictionary:dict];
        self.city                     = [self objectOrNilForKey:@"city" fromDictionary:dict];
        self.area                     = [self objectOrNilForKey:@"area" fromDictionary:dict];
        self.storeID                  = [self objectOrNilForKey:@"storeID" fromDictionary:dict];
        self.companyID                = [self objectOrNilForKey:@"companyID" fromDictionary:dict];
        self.store_phone              = [self objectOrNilForKey:@"store_phone" fromDictionary:dict];
        self.store_email              = [self objectOrNilForKey:@"store_email" fromDictionary:dict];
        self.isValid                  = [self objectOrNilForKey:@"isValid" fromDictionary:dict];
        self.shop_hours               = [self objectOrNilForKey:@"shop_hours" fromDictionary:dict];
        self.instruction              = [self objectOrNilForKey:@"instruction" fromDictionary:dict];
        self.store_img                = [self objectOrNilForKey:@"store_img" fromDictionary:dict];
        self.address                  = [self objectOrNilForKey:@"address" fromDictionary:dict];
        self.dividend                 = [self objectOrNilForKey:@"dividend" fromDictionary:dict];
        self.account_money            = [self objectOrNilForKey:@"account_money" fromDictionary:dict];
        self.collect_money            = [self objectOrNilForKey:@"collect_money" fromDictionary:dict];
        self.freeze_money             = [self objectOrNilForKey:@"freeze_money" fromDictionary:dict];
        self.trade_money              = [self objectOrNilForKey:@"trade_money" fromDictionary:dict];
        self.trade_count              = [self objectOrNilForKey:@"trade_count" fromDictionary:dict];
        self.dividend_money           = [self objectOrNilForKey:@"dividend_money" fromDictionary:dict];

    }
    return self;
}

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}


@end
